<template>
  <div ref="alipayRef" v-html="alipayForm"></div>
</template>

<script setup>
import { ref, nextTick, getCurrentInstance } from 'vue'
import { useRoute, useRouter } from 'vue-router'

const { proxy } = getCurrentInstance()

const route = useRoute()
const router = useRouter()

let alipayForm = ref()
if (!route.query.htmlData) {
  router.back()
} else {
  alipayForm.value = route.query.htmlData
  nextTick(() => {
    proxy.$refs.alipayRef.children[0].submit()
  })
}
</script>
